import { reqFindHeadCategory } from '@/api/home'
export default {
  // vue3里是一个函数返回数据
  namespaced: true,
  state: () => {
    return {
      list: []
    }
  },
  mutations: {
    setList (state, newList) {
      state.list = newList
    }
  },
  actions: {
    async getList (context) {
      // 发请求
      const { result } = await reqFindHeadCategory()
      context.commit('setList', result)
    }
  }
}
